function showTable(num){
	if(num == 1){
		document.location.href="index.php?controller=Product&action=Increase&kind=1";
	}else if(num == 2){
		document.location.href="index.php?controller=Product&action=Increase&kind=2";
	}else if(num ==3){
		document.location.href="index.php?controller=Product&action=Increase&kind=3";
	}
}

var i=j=k=l=2;
function add_file(obj){
	var span = document.createElement('span');
	if(i < 21) {
		var fileid = 'format[]';
		span.setAttribute('id',fileid);
		span.innerHTML = "<input type='text' name ='"+fileid+"' value=''></input><br>";
		document.getElementById(obj).appendChild(span);
		i++;
	}
}
function add_file1(obj){
	var span = document.createElement('span');
	if(j < 21){
		var fileid = 'model[]';
		span.setAttribute('id',fileid);
		span.innerHTML = "<input type='text' name ='"+fileid+"' value=''></input><br>";
		document.getElementById(obj).appendChild(span);
		j++;
	}
}

function add_file2(obj){
	var span = document.createElement('span');
	if(k < 21){
		var fileid = 'productNumber[]';
		span.setAttribute('id',fileid);
		span.innerHTML = "<input type='text' name ='"+fileid+"' value=''></input><br>";
		document.getElementById(obj).appendChild(span);
		k++;
	}
}

var l=-1;
function AddRow(count){
 l=l+1;
 var table=document.getElementById("d_message");
 var row=table.insertRow();
 var cell=row.insertCell();
 cell.parentElement.id=l;

 cell.innerHTML="<input type=\"text\" name=\"dispatching_name[]\" value=\"\" /><input type=\"text\" name=\"dispatching_area[]\" value=\"\" />";
}

function changeTitle(num){
	var obj1 = document.getElementById('change1');
	var obj2 = document.getElementById('change2');
	var obj3 = document.getElementById('change3');
	var obj4 = document.getElementById('change4');
	
	if(num == 1){
		obj1.innerHTML="生产";
		obj2.innerHTML="生产";
		obj3.innerHTML="生产";
		obj4.innerHTML="生产";
	}else{
		obj1.innerHTML="经营";
		obj2.innerHTML="经营";
		obj3.innerHTML="经营";
		obj4.innerHTML="经营";
	}
}

function addInput(objname,num,target){
	var obj = document.getElementById(objname);
	if(num == target){
		obj.innerHTML="<input name=\"materialMore\" type=\"text\" value=\"\" \/>";
	}else{
		obj.innerHTML='';
	}
}

function addInput2(objname,num){
	if(num == 2){
		var obj = document.getElementById(objname);
		obj.innerHTML="<input name=\"positionMore\" type=\"text\" value=\"\" \/>";
	}
}


function showDIV(obj){
	
	var nerve = document.getElementById('nerve');
	var cert = document.getElementById('cert');
	var company = document.getElementById('company');
	//var packageobj = document.getElementById('package');
	
	if(obj == 'nerve'){
		nerve.style.display="block";
		cert.style.display="none";
		company.style.display="none";
		//packageobj.style.display="none";
	}else if(obj == 'cert'){
		nerve.style.display="none";
		cert.style.display="block";
		company.style.display="none";
		//packageobj.style.display="none";
	}else if(obj == 'company'){
		nerve.style.display="none";
		cert.style.display="none";
		company.style.display="block";
		//packageobj.style.display="none";
	}else if(obj == 'package'){
		nerve.style.display="none";
		cert.style.display="none";
		company.style.display="none";
		//packageobj.style.display="block";
	}
}

function checkboxShow(objnum,num,total){
	var j = total+1;
	var i = 1;
	while(i < j){
		var objname = 'package'+ objnum +'_' + i;
		var obj = document.getElementById(objname);
		var point = obj.getElementsByTagName("input") ;
		if(i == num){
			obj.style.display = "block";
			for(var x = 0; x < point.length;x++){
				point[x].disabled = false;
			}
			
		}else{
			obj.style.display = "none";
			for(var x = 0; x < point.length;x++){
				point[x].disabled = true;
			}
		}
		i++;
	}
}

function inputLive(num){
	var objname = 'other'+num;
	var checkname = 'self'+num;
	var obj = document.getElementById(objname);
	var check = document.getElementById(checkname);
	if(check.checked == true){
			obj.style.display = "block";
	}else{
			obj.style.display = "none";
	}
		
}

